import request from '@/config/axios'

// 交接附件 VO
export interface HandoverAttachmentVO {
  id: number // 主键ID
  handoverId: number // 交接单ID
  fileName: string // 文件名
  fileSize: number // 文件大小（字节）
  createDate: Date // 创建日期
  filePath: string // 文件存储路径
  createdAt: Date // 创建时间
}

// 交接附件 API
export const HandoverAttachmentApi = {
  // 查询交接附件分页
  getHandoverAttachmentPage: async (params: any) => {
    return await request.get({ url: `/oa/handover-attachment/page`, params })
  },

  // 查询交接附件详情
  getHandoverAttachment: async (id: number) => {
    return await request.get({ url: `/oa/handover-attachment/get?id=` + id })
  },

  // 新增交接附件
  createHandoverAttachment: async (data: HandoverAttachmentVO) => {
    return await request.post({ url: `/oa/handover-attachment/create`, data })
  },

  // 修改交接附件
  updateHandoverAttachment: async (data: HandoverAttachmentVO) => {
    return await request.put({ url: `/oa/handover-attachment/update`, data })
  },

  // 删除交接附件
  deleteHandoverAttachment: async (id: number) => {
    return await request.delete({ url: `/oa/handover-attachment/delete?id=` + id })
  },

  // 导出交接附件 Excel
  exportHandoverAttachment: async (params) => {
    return await request.download({ url: `/oa/handover-attachment/export-excel`, params })
  }
}